---
title: "Supplemental Information for: Under the Roof of Rebels: Civilian Targeting after Territorial Takeover in Sierra Leone"
author:
- name: Christian Oswald
  affiliation: Department of Political Science, Trinity College Dublin, \email{coswald@tcd.ie}
- name: Melanie Sauter
  affiliation: Department of Political and Social Sciences, European University Institute, \email{melanie.sauter@eui.eu}
- name: Sigrid Weber
  affiliation: Department of Political Science, University College London, \email{s.weber.17@ucl.ac.uk}
- name: Rob Williams
  affiliation: Department of Political Science, Washington University in St. Louis, \email{rob.williams@wustl.edu}
date: "`r format(Sys.time(), '%d %B, %Y')`"
geometry: margin=1in
header-includes:
  - \usepackage{lscape}
  - \newcommand{\blandscape}{\begin{landscape}}
  - \newcommand{\elandscape}{\end{landscape}}
output: 
  pdf_document:
    toc: true
    number_sections: true
    template: template.tex
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = F, message = F, warning = F, cache = T, fig.pos = 'htbp!')
```



```{r data_prep, results = 'hide'}
## clear environment
rm(list = ls())

## load packages
library(sf) # vector spatial data
library(raster) # continuous spatial data
library(dplyr) # data manipulation
library(ggplot2) # plotting
library(corrplot) # fancy correlation plots
library(reshape2) # melting for histograms
options(java.parameters = "-Xmx2g") # set java heap size before loading mwa
library(mwa) # matched wake analysis
library(xtable) # tex tables for export

## called via namespace instead of loaded
## - meltt
## - lubridate

## custom blank theme
theme_rw <- function() {
  theme_bw() +
    theme(plot.background = element_blank(), panel.grid.minor = element_blank(),
          panel.grid.major = element_blank(), panel.border = element_blank())
  
}



## load data ####

## load ACLED
ACLED <- read.csv('Data/events/Africa_1997-2018_upd-Jul23.csv')

## load GED
load('Data/events/ged172.Rdata')

## load population data
pop_dens <- raster('Data/rasters/pop_dens.tif')
pop_tot <- raster('Data/rasters/pop_count.tif')

## load nightlights
nl <- raster('Data/rasters/nightlights.tif')

## load shapefiles
cshapes <- st_read('Data/cshapes', 'cshapes')
sl <- readRDS('Data/subnational_boundaries/gadm36_SLE_2_sf.rds')

## load road data
roads <- st_read('Data/roads',
                 'A_and_B_all_utm29_distance_aggregated_to_AandB_junctions')

## load diamond data
diamonds <- st_read('Data/diamonds/dDIAL.shp')

## load one sided violence data
OSV <- read.csv('Data/events/ucdp-onesided-181.csv')

## load taxonomies for meltt
taxonomies <- lapply(list.files('Taxonomies/', full.names = T), read.csv)
names(taxonomies) <- c('actor_tax', 'event_tax', 'prec_tax')

## correct source names to uppercase in event taxonomy
taxonomies$actor_tax$data.source <- toupper(taxonomies$actor_tax$data.source)



## meltt preparation ####

# for events
names(GED)[names(GED)=='type_of_vi'] = 'event_tax'
names(ACLED)[names(ACLED)=='EVENT_TYPE'] = 'event_tax'

# for actors
names(GED)[names(GED)=='side_a'] = 'actor_tax' # given UCPD dyad conventions
names(ACLED)[names(ACLED)=='ACTOR1'] = 'actor_tax'

# for precision
names(GED)[names(GED)=='where_prec'] = 'prec_tax'
names(ACLED)[names(ACLED)=='GEO_PRECISION'] = 'prec_tax'

# Cleaning UCDP-GED
GED$date_start = as.Date(GED$date_start)
names(GED)[names(GED)=='date_start'] = 'date'
GED$date_end = as.Date(GED$date_end)
names(GED)[names(GED)=='date_end'] = 'enddate'

# Cleaning ACLED
colnames(ACLED) = tolower(colnames(ACLED))
ACLED$date = as.Date(ACLED$event_date)

## count peacekeeper violence against civilians
pk_total_events <- ACLED %>% filter(country == 'Sierra Leone',
                                    event_tax == 'Violence against civilians',
                                    year >= 1997, year <= 2001,
                                    grepl('ECOMOG|UNAMSIL', actor_tax)) %>%
  nrow()

## limit to violence against civilians in Sierra Leone
ACLED <- ACLED %>% filter(country == 'Sierra Leone',
                          event_tax == 'Violence against civilians',
                          year >= 1997, year <= 2001,
                          !grepl('Military|ECOMOG|UNAMSIL', actor_tax))
GED <- GED %>% filter(country == 'Sierra Leone',
                      event_tax == 3, year >= 1997, year <= 2001,
                      !grepl('Government', actor_tax))

## number of civilian targeting events in each
GED_total_events <- nrow(GED)
ACLED_total_events <- nrow(ACLED)

## number of RUF civilian targeting events in each
ACLED_RUF_events <- ACLED %>% filter(grepl('RUF', actor_tax)) %>% nrow()
GED_RUF_events <- GED %>% filter(grepl('RUF', actor_tax)) %>% nrow()

## number of times west side boys captured territory
ACLED %>% filter(grepl('West Side', actor_tax),
                 event_tax == 'Battle-Non-state actor overtakes territory') %>%
  nrow()

## number of groups in each dataset
unq_GED <- unique(GED$actor_tax)
unq_ACLED <- unique(ACLED$actor_tax)

## high precision versions for precisions subset analysis later
ACLED_prec <- ACLED %>% filter(prec_tax <= 2)
GED_prec <- GED %>% filter(prec_tax <= 2)

## combine events
output <- meltt::meltt(ACLED, GED, taxonomies = taxonomies, twindow = 10, spatwindow = 10)

## get number of duplicated events
dup_events <- nrow(output$processed$event_matched)

# get matched events from each dataset
ACLED_match <- ACLED[output$processed$event_matched$event1,]
GED_match <- GED[output$processed$event_matched$event2,]

# look for cross-dataset RUF matches
GED_RUF_overlap <- GED_match[grepl('RUF', ACLED_match$actor_tax), ] %>%
  pull(actor_tax) %>%
  as.character() %>%
  table()
ACLED_RUF_overlap <- ACLED_match[grepl('RUF', GED_match$actor_tax), ] %>%
  pull(actor_tax) %>%
  as.character() %>%
  table()

## count number of AFRC matches correctly identified
sum(grepl('AFRC', GED_match$actor_tax) & grepl('AFRC', ACLED_match$actor_tax))

## get number of total input events -- same regardless of aggregation rules
total_events <- nrow(output$processed$complete_index)

## calculate percent overlap between datasets
overlap <- nrow(output$processed$event_matched) / nrow(output$processed$deduplicated_index)

## extract combined civilian targeting events
civ_comb <- meltt::meltt_data(output)

## count RUF events in merged data
merged_RUF_events <- civ_comb %>% filter(grepl('RUF', actor_tax)) %>% nrow()

## reload ACLED for capitalized variable names
ACLED <- read.csv('Data/events/Africa_1997-2018_upd-Jul23.csv', stringsAsFactors = F)



## spatial data prep ####

## subset population data to polygon
pop_dens <- crop(pop_dens, cshapes %>% filter(CNTRY_NAME == 'Sierra Leone'))
pop_tot <- crop(pop_tot, cshapes %>% filter(CNTRY_NAME == 'Sierra Leone'))
nl <- crop(nl, cshapes %>% filter(CNTRY_NAME == 'Sierra Leone'))

## create sf object for capital
capital <- cshapes %>% filter(CNTRY_NAME == 'Sierra Leone') %>%
  st_set_geometry(NULL) %>% 
  st_as_sf(coords = c('CAPLONG', 'CAPLAT'), crs = 4326)

## project roads to WGS84
roads <- st_transform(roads, st_crs(cshapes))

## susbet diamonds to sierra leone
diamonds <- diamonds %>% filter(COUNTRY == 'Sierra Leone')



## event data prep ####

## subset to sierra leone
ACLED <- ACLED %>% filter(COUNTRY == 'Sierra Leone', YEAR %in% 1997:2001)

## limit to battles and exclude state perpetrated violence against civilians; drop
## intra-group conflicts; consolidate factional sub-actors into single actors
battles <- ACLED %>%
  filter(EVENT_TYPE %in% c('Battle-No change of territory',
                           'Battle-Non-state actor overtakes territory'),
         !(grepl('Military|Police', ACTOR1, ignore.case = T) &
             EVENT_TYPE == 'Violence against civilians'),
         ACTOR1 != ACTOR2) %>%
  mutate(ACTOR1 = ifelse(grepl('Kamajor Militia', ACTOR1),
                         'Kamajor Militia', ACTOR1),
         ACTOR1 = ifelse(grepl('AFRC: Armed Forces Revolutionary Council', ACTOR1),
                         'AFRC: Armed Forces Revolutionary Council', ACTOR1),
         ACTOR1 = ifelse(grepl('RUF: Revolutionary United Front', ACTOR1),
                         'RUF: Revolutionary United Front', ACTOR1),
         ACTOR2 = ifelse(grepl('Kamajor Militia', ACTOR2),
                         'Kamajor Militia', ACTOR2),
         ACTOR2 = ifelse(grepl('AFRC: Armed Forces Revolutionary Council', ACTOR2),
                         'AFRC: Armed Forces Revolutionary Council', ACTOR2),
         ACTOR2 = ifelse(grepl('RUF: Revolutionary United Front', ACTOR2),
                         'RUF: Revolutionary United Front', ACTOR2))

## limit events to largest rebel groups
battles <- battles %>% filter(ACTOR1 %in% c('Kamajor Militia',
                                          'AFRC: Armed Forces Revolutionary Council',
                                          'RUF: Revolutionary United Front') |
                              ACTOR2 %in% c('Kamajor Militia',
                                            'AFRC: Armed Forces Revolutionary Council',
                                            'RUF: Revolutionary United Front'))

## limit events to RUF
battles <- battles %>% filter(ACTOR1 == 'RUF: Revolutionary United Front' |
                              ACTOR2 == 'RUF: Revolutionary United Front') %>%
  mutate(timestamp = lubridate::ymd(EVENT_DATE), lat = LATITUDE, lon = LONGITUDE) %>%
  dplyr::select(timestamp, lat, lon, EVENT_TYPE) %>%
  filter(lubridate::year(timestamp) %in% 1997:2001)
```

```{r analysis_main, results = 'hide'}
## attributed RUF attacks only ####

## get violence against civilians
civs_RUF <- civ_comb %>%
  filter(grepl('RUF', actor_tax)) %>% 
  mutate(EVENT_TYPE = 'Violence against civilians',
         lat = latitude, lon = longitude,
         timestamp = date) %>% 
  dplyr::select(timestamp, lat, lon, EVENT_TYPE)

## combine treatment, control, and dependent events
mw_data_RUF <- rbind(battles, civs_RUF)

## create sf of events to measure spatial covariates
mw_data_sf_RUF <- st_as_sf(mw_data_RUF, coords = c('lon', 'lat'),
                           crs = 4326, agr = 'identity')

## measure spatial covariates
mw_data_RUF <- mw_data_RUF %>%
  mutate(pop_dens = log(raster::extract(pop_dens, mw_data_sf_RUF)),
         pop_tot = log(raster::extract(pop_tot, mw_data_sf_RUF)),
         nl = raster::extract(nl, mw_data_sf_RUF),
         cap_dist = log(units::set_units(st_distance(mw_data_sf_RUF, capital, by_element = T), km)),
         road_dist = log(units::set_units(apply(st_distance(mw_data_sf_RUF, roads), 1, min), km)),
         dia_dist = log(units::set_units(apply(st_distance(mw_data_sf_RUF, diamonds), 1, min), km)),
         year = lubridate::year(timestamp))

## carry out matched wake analysis; no SUTVA control
mw_RUF <- matchedwake(mw_data_RUF, t_window = c(5, 60, 5), spat_window = c(2, 10, 2),
                      treatment = c('EVENT_TYPE',
                                    'Battle-Non-state actor overtakes territory'),
                      control = c('EVENT_TYPE',
                                  'Battle-No change of territory'),
                      dependent = c('EVENT_TYPE',
                                    'Violence against civilians'),
                      matchColumns = c('pop_dens', 'nl', 'cap_dist',
                                       'road_dist', 'dia_dist'), alpha2 = .05)

## carry out matched wake analysis; past treatment control control
mw_RUF_tcm <- matchedwake(mw_data_RUF, t_window = c(5, 60, 5), spat_window = c(2, 10, 2),
                          treatment = c('EVENT_TYPE',
                                        'Battle-Non-state actor overtakes territory'),
                          control = c('EVENT_TYPE',
                                      'Battle-No change of territory'),
                          dependent = c('EVENT_TYPE',
                                        'Violence against civilians'),
                          matchColumns = c('pop_dens', 'nl', 'cap_dist',
                                           'road_dist', 'dia_dist'),
                          TCM = T, alpha2 = .05)

## carry out matched wake analysis; delete SUTVA violations control
mw_RUF_stva <- matchedwake(mw_data_RUF, t_window = c(5, 60, 5), spat_window = c(2, 10, 2),
                           treatment = c('EVENT_TYPE',
                                         'Battle-Non-state actor overtakes territory'),
                           control = c('EVENT_TYPE',
                                       'Battle-No change of territory'),
                           dependent = c('EVENT_TYPE',
                                         'Violence against civilians'),
                           matchColumns = c('pop_dens', 'nl', 'cap_dist',
                                            'road_dist', 'dia_dist'),
                           deleteSUTVA = T, alpha2 = .05)

## carry out matched wake analysis; no SUTVA control; weighted
mw_RUF_wg <- matchedwake(mw_data_RUF, t_window = c(5, 60, 5), spat_window = c(2, 10, 2),
                         treatment = c('EVENT_TYPE',
                                       'Battle-Non-state actor overtakes territory'),
                         control = c('EVENT_TYPE',
                                     'Battle-No change of territory'),
                         dependent = c('EVENT_TYPE',
                                       'Violence against civilians'),
                         matchColumns = c('pop_dens', 'nl', 'cap_dist',
                                          'road_dist', 'dia_dist'),
                         weighted = T, alpha2 = .05)

## carry out matched wake analysis; past treatment control control; weighted
mw_RUF_wg_tcm <- matchedwake(mw_data_RUF, t_window = c(5, 60, 5), spat_window = c(2, 10, 2),
                             treatment = c('EVENT_TYPE',
                                           'Battle-Non-state actor overtakes territory'),
                             control = c('EVENT_TYPE',
                                         'Battle-No change of territory'),
                             dependent = c('EVENT_TYPE',
                                           'Violence against civilians'),
                             matchColumns = c('pop_dens', 'nl', 'cap_dist',
                                              'road_dist', 'dia_dist'),
                             TCM = T, weighted = T, alpha2 = .05)

## carry out matched wake analysis; delete SUTVA violations control; weighted
mw_RUF_wg_stva <- matchedwake(mw_data_RUF, t_window = c(5, 60, 5), spat_window = c(2, 10, 2),
                              treatment = c('EVENT_TYPE',
                                            'Battle-Non-state actor overtakes territory'),
                              control = c('EVENT_TYPE',
                                          'Battle-No change of territory'),
                              dependent = c('EVENT_TYPE',
                                            'Violence against civilians'),
                              matchColumns = c('pop_dens', 'nl', 'cap_dist',
                                               'road_dist', 'dia_dist'),
                              deleteSUTVA = T, weighted = T, alpha2 = .05)
```

# Overview

This Supplemental Information contains descriptive statistics for all matching covariates used in the research note (for full matching statistics and estimates for all time-space windows see end of SI). The material first reports different model specifications for the matched wake analysis (MWA) on civilian targeting that can be associated with the RUF (main model presented in the research note). Whenever a model in this SI uses the same modeling choices as the model presented in the research note, difference-in-differences regression is weighted by the number of treatment cases compared to control cases and matched on counts of previous treatment and control events, it is reported **in bold**. This is true even when the model is fit on a different subset of data. However, the modeling assumptions will be the same for all models presented in bold. In addition, models for data subsets are reported: We fit multiple models for all three main rebel groups in Sierra Leone, for areas that are either far or close from the capital; for areas where diamond mines are close-by or not, and for only precisely reported events. Robustness tests are also provided by reporting models that only use ACLED events and alternate space-time windows. We also provide a qualitative assessment of our dependent events in ACLED and GED data to provide more background on the violence against civilians conducted by the RUF.  

\clearpage

# Descriptive Statistics

This section presents the distribution and correlation of the 5 matching covariates used in the research note. Furthermore, the empirical cumulative distribution function of civilian fatalities in the UCDP One Sided Violence Dataset is reported. In addition, it presents the distribution of population density compared to the location of treatment, control, and dependent events.

```{r desc_hist, fig.cap = 'Distributions of matching covariates.', out.width = '5in',fig.align='center'}
## create renamed dataframes for ggplot graphics
mw_data_RUF_gg <- mw_data_RUF %>%
  filter(EVENT_TYPE != 'Violence against civilians') %>%
  dplyr::select('ln(Population Density)' = pop_dens,
                'Nightlights' = nl,
                'ln(Capital Distance)' = cap_dist,
                'ln(Road Distance)' = road_dist,
                'ln(Diamond Distance)' = dia_dist)

ggplot(melt(mw_data_RUF_gg), aes(x = value)) +
  geom_histogram() +
  facet_wrap(~ variable, scales = 'free') +
  theme_rw()
```

```{r dest_cor, fig.cap = 'Correlation of matching covariates.', out.width = '5in',fig.align='center'}
corrplot(cor(mw_data_RUF_gg),tl.col = "black")
```

```{r desc_ecdf, fig.cap = 'Empirical CDF of civilian fatalities inflicted by each rebel group in the UCDP One Sided Violence Data.', fig.lp = 'ecdf', fig.width = 8, fig.height = 3}
## calculate total fatalities in each actor-civilian dyad
OSV_ecdf <- OSV %>% filter(!grepl('Government', actor_name)) %>%
  group_by(conflict_id) %>%
  summarize(fatalities = sum(best_fatality_estimate),
            name = unique(actor_name)) %>%
  arrange(fatalities)

## calculate quantile of RUF civilian targeting
all_quantile <- which(OSV_ecdf$conflict_id %in% (GED %>% filter(actor_tax %in% c('RUF',
                                                                                 'AFRC',
                                                                                 'Kamajors')) %>%
                        dplyr::select(conflict_n) %>%
                        unique() %>% pull()))

## create dataframe for plotting
all_quantile <- data.frame(quantile = all_quantile / nrow(OSV_ecdf),
                           fatalities = OSV_ecdf %>% slice(all_quantile) %>%
                             mutate(fatalities = log(fatalities)) %>% pull(fatalities),
                           name = OSV_ecdf %>% slice(all_quantile) %>% pull(name))

## plot ecdf of fatalities
ggplot(OSV_ecdf, aes(x = log(fatalities))) +
  stat_ecdf(geom = 'step', pad = F) +
  geom_point(data = all_quantile,
             aes(x = fatalities, y = quantile), inherit.aes = F, size = 2) +
  labs(x = 'ln(Fatalties)', y = 'Quantile') +
  geom_text(data = all_quantile,
                  aes(x = fatalities, y = quantile, label = name),
                  inherit.aes = F, nudge_x = -.25, nudge_y = .1, size = 3) +
  theme_rw()
```

```{r desc_map, fig.cap = 'Distribution of (logged) population density in km$^2$ and events. Chiefdom boundaries in black.',fig.align='center', fig.width =8, fig.height = 8,out.width='64%'}
## set transparent RGB colors for events
cols = c(rgb(1, 0, 0, .25), rgb(0, 1, 0, .25), rgb(0, 0, 1, .25))

## plot masked, logged population density
plot(mask(log(pop_dens), cshapes), axes = F, box = F, legend = T,
     legend.args = list(text = expression('ln(Population/km' ^2 ~ ')'), side=2))

## plot chiefdom boundaries
plot(sl$geometry, add = T, col = NA)

## plot events
plot(mw_data_sf_RUF$geometry, add = T, cex = .5, pch = 16,
     col = cols[as.factor(mw_data_sf_RUF$EVENT_TYPE)])

## add legend
legend('bottomleft', legend = unique(mw_data_sf_RUF$EVENT_TYPE), col = cols,
       pch = 16, cex = .80, horiz = F, bty = 'n')
```

\clearpage

# In-Text Results

This section presents any numerical results or data descriptions presented in-text in the research note.

- Total count of civilian targeting events in ACLED on 8. 5: `r ACLED_total_events`
- Total count of civilian targeting events in GED on p. 8: `r GED_total_events`
- Total count of civilian targeting events in ACLED and GED on p. 8: `r ACLED_total_events + GED_total_events`
- Number of duplicate civilian targeting events identified by `meltt` and excluded from our analysis: `r dup_events`
- Count of RUF civilian targeting events in ACLED in footnote 4: `r ACLED_RUF_events`
- Count of RUF civilian targeting events in GED in footnote 4: `r GED_RUF_events`
- Count of RUF civilian targeting events in ACLED and GED in footnote 4: `r ACLED_RUF_events + GED_RUF_events`
- Total count of civilian targeting events by peacekeeping forces in footnote 5: `r pk_total_events`
- Number of unique groups in ACLED in footnote 5: `r length(unq_ACLED)`
- Overlap of events between ACLED and GED on p. 17: `r overlap`

\clearpage

# RUF Targeting

This section presents results from models that test the effect of RUF territorial takeover on subsequent civilian targeting by the RUF. This means that the dependent variable is only civilian targeting events that can be attributed to the RUF. After presenting the frequency of treatment, control, and dependent events in the dataset, we report different model specifications. 

```{r main_desc_event_hist, fig.cap = 'Frequency of treatment, control, and dependent events.',    fig.height = 3, fig.width=8, out.width = '6in'}
ggplot(mw_data_RUF, aes(x = timestamp)) +
  geom_histogram() +
  facet_wrap(~ EVENT_TYPE) +
  labs(x = '', y = 'Count') +
  theme_rw() +
  theme(strip.text = element_text(size = 7.5))
```


From upper left to bottom right, the matched wake analysis included (1) no weighting or controlling for overlapping events, (2) controlling for previous treatment and control events, (3) omitting overlapping wakes, (4) weighting to account for unbalanced treatment, **(5) weighting and controlling for previous events**, (6) weighting and omitting overlapping events. 
As this is the data sample used in the paper, Figure (5) in this section replicates the model presented in the paper.

```{r main_plot_1_2, fig.ncol=2,out.width = '3in', results='hide', fig.ncol=2, out.width = '3in'}
plot(mw_RUF)
plot(mw_RUF_tcm)
```

```{r main_plot_3_4, fig.ncol=2,out.width = '3in', results='hide', fig.ncol=2, out.width = '3in'}
plot(mw_RUF_stva)
plot(mw_RUF_wg)
```

```{r main_plot_5_6, fig.ncol=2,out.width = '3in', results='hide', fig.ncol=2, out.width = '3in'}
plot(mw_RUF_wg_tcm)
plot(mw_RUF_wg_stva)
```

\clearpage

# Subset Analysis, splitted by distance to capital

This section presents results for splitting the data into two subsets depending on the median distance to the capital. The effect of territorial capture on subsequent RUF civilian targeting is shown for **(1) observations under the median distance to the capital only** and **(2) observations above the median distance to the capital**. Both regressions are weighted to account for unbalanced treatment and control events; and matching on previous events is included. This subsetting shows that we observe a positive treatment effect only if events take place far from the capital. This is likely the case because the government often retakes territory close to the capital before rebels can establish control. 

```{r analysis_distance, results = 'hide'}
## attributed RUF attacks subset by capital distance ####

## split RUF attacks data in half based on capital distance
mw_data_RUF_near <- mw_data_RUF %>% filter(cap_dist < median(cap_dist))
mw_data_RUF_far <- mw_data_RUF %>% filter(cap_dist >= median(cap_dist))

## get number of civilan targeting events near diamond mines
mw_data_RUF_near_count <- mw_data_RUF_near %>% filter(EVENT_TYPE == 'Violence against civilians') %>%
  nrow()
mw_data_RUF_far_count <- mw_data_RUF_far %>% filter(EVENT_TYPE == 'Violence against civilians') %>%
  nrow()

## carry out matched wake analysis; past treatment control control; weighted; near
mw_RUF_near_wg_tcm <- matchedwake(mw_data_RUF_near, t_window = c(5, 60, 5),
                                  spat_window = c(2, 10, 2),
                                  treatment = c('EVENT_TYPE',
                                                'Battle-Non-state actor overtakes territory'),
                                  control = c('EVENT_TYPE',
                                              'Battle-No change of territory'),
                                  dependent = c('EVENT_TYPE',
                                                'Violence against civilians'),
                                  matchColumns = c('pop_dens', 'nl', 'cap_dist',
                                                   'road_dist', 'dia_dist'),
                                  TCM = T, weighted = T, alpha2 = .05)

## carry out matched wake analysis; past treatment control control; weighted; far
mw_RUF_far_wg_tcm <- matchedwake(mw_data_RUF_far, t_window = c(5, 60, 5),
                                 spat_window = c(2, 10, 2),
                                 treatment = c('EVENT_TYPE',
                                               'Battle-Non-state actor overtakes territory'),
                                 control = c('EVENT_TYPE',
                                             'Battle-No change of territory'),
                                 dependent = c('EVENT_TYPE',
                                               'Violence against civilians'),
                                 matchColumns = c('pop_dens', 'nl', 'cap_dist',
                                                  'road_dist', 'dia_dist'),
                                 TCM = T, weighted = T, alpha2 = .05)
```

```{r dist_plot, fig.ncol=2,out.width = '3in', results='hide', fig.ncol=2, out.width = '3in'}
plot(mw_RUF_near_wg_tcm )
plot(mw_RUF_far_wg_tcm )
```

\clearpage

# Subset Analysis, splitted by distance to next diamond mine

This section presents results for splitting the data into two subsets depending on the median distance to the next diamond mine. The effect of territorial capture on subsequent RUF civilian targeting is shown for **(1) observations under the median distance to diamond mines** and **(2) observations above the median distance to diamond mines**. Both regressions are weighted to account for unbalanced treatment and control events; and matching on previous events is included. With this subsetting we aim to explore if our mechanism holds true for regions with and without diamond resources as this might change incentives for the RUF to attack civilians. Indeed we find that the RUF conducted more attacks against civilians in areas where they could extract resources, violently forcing civilians to work in mines. This suggests that transition periods are only particularly violent if civilian support is not the main resource rebel groups rely on.

```{r analysis_diamond, results='hide'}
## attributed RUF attacks subset by distance to diamond mines ####

## split RUF attacks data in half based on capital distance
diamond_near <- mw_data_RUF %>% filter(dia_dist < median(dia_dist))
diamond_far <- mw_data_RUF %>% filter(dia_dist >= median(dia_dist))

## get number of civilan targeting events near diamond mines
diamond_near_count <- diamond_near %>% filter(EVENT_TYPE == 'Violence against civilians') %>%
  nrow()
diamond_far_count <- diamond_far %>% filter(EVENT_TYPE == 'Violence against civilians') %>%
  nrow()

## carry out matched wake analysis; past treatment control control; weighted; near
mw_RUF_dia_near_wg_tcm <- matchedwake(diamond_near, t_window = c(5, 60, 5),
                                      spat_window = c(2, 10, 2),
                                      treatment = c('EVENT_TYPE',
                                                    'Battle-Non-state actor overtakes territory'),
                                      control = c('EVENT_TYPE',
                                                  'Battle-No change of territory'),
                                      dependent = c('EVENT_TYPE',
                                                    'Violence against civilians'),
                                      matchColumns = c('pop_dens', 'nl', 'cap_dist',
                                                       'road_dist', 'dia_dist'),
                                      TCM = T, weighted = T, alpha2 = .05)

## carry out matched wake analysis; past treatment control control; weighted; far
mw_RUF_dia_far_wg_tcm <- matchedwake(diamond_far, t_window = c(5, 60, 5),
                                     spat_window = c(2, 10, 2),
                                     treatment = c('EVENT_TYPE',
                                                   'Battle-Non-state actor overtakes territory'),
                                     control = c('EVENT_TYPE',
                                                 'Battle-No change of territory'),
                                     dependent = c('EVENT_TYPE',
                                                   'Violence against civilians'),
                                     matchColumns = c('pop_dens', 'nl', 'cap_dist',
                                                      'road_dist', 'dia_dist'),
                                     TCM = T, weighted = T, alpha2 = .05)
```

```{r diamond_plot, fig.ncol=2,out.width = '3in', results='hide', fig.ncol=2, out.width = '3in'}
plot(mw_RUF_dia_near_wg_tcm )
plot(mw_RUF_dia_far_wg_tcm )
```

\clearpage

# Subset Analysis, reduced to precisely reported events

This section presents the effect of territorial capture on subsequent RUF civilian targeting for precisely reported events only. In terms of data quality in ACLED and GED, an in-depth comparison for two country years, Algeria 1997 and Burundi 2000, has shown that there can be huge differences. It was shown that for Algeria 1997 52 \% of events and for Burundi 2000 25 \% of events in ACLED suffered one or more problems, such as incorrect region and/or location (administrative level 1 and 2), incorrect geoprecision code (i.e. events were given a code not corresponding to actual location information), double-coded and missing events, compared to 5 and 2 \%, respectively, for GED (Eck 2012, 131). This led to for example locating an event 150 km away from its actual location since villages/towns had the same name but were in different regions. Furthermore, ACLED by default uses the provincial capital as location if a news article only mentions the province name whereas GED uses the centroid point if available and the provincial capital only if this point is missing. Related to this it was shown that the geoprecision code, which ranges from 1-3 for ACLED and 1-7 for GED and 1 meaning exact location information for both datasets, was inaccurate in 29 \% of events for Algeria and in 18 \% of events for Burundi. As a result, ACLED may introduce systematic bias by attributing events to provincial capitals when in fact they took place in rural areas (Eck 2012, 132). In fact for Africa 1997-2010 ACLED has the highest value of geoprecision for 77 \% of violent events whereas GED has this level only for 29 \%. Quite a few countries show levels of well above 90 \% geoprecision which seems to be driven by the above mentioned practice given the three-level process employed for GED to ensure accuracy and given that fighting often takes place outside urban areas.

The models presented in this sections use data that was restricted to ACLED events where either the exact town or a small part of a region are known (ACLED geo-precision codes 1 & 2). From the GED data, only events where the exact point or a maximum of ca. 25 km precision around a point was known were included (GED geo-precision codes 1 & 2). The plots show the matched wake analysis for (1) no weighting or controlling for overlapping events, (2) controlling for previous treatment and control events, (3) omitting overlapping wakes, (4) weighting to account for unbalanced treatment, **(5) weighting and controlling for previous events**, (6) weighting and omitting overlapping events.

```{r analysis_precision, results='hide'}
## create temporary copies of GED and ACLED before swapping in high precision versions
GED_temp <- GED
ACLED_temp <- ACLED

## temporarily assign high precision versions to main object names
GED <- GED_prec
ACLED <- ACLED_prec

## combine events
output_prec <- meltt::meltt(ACLED, GED, taxonomies = taxonomies,
                            twindow = 10, spatwindow = 10)

## extract combined civilian targeting events
civ_comb_prec <- meltt::meltt_data(output_prec)

## reload ACLED for capitalized variable names
ACLED <- read.csv('Data/events/Africa_1997-2018_upd-Jul23.csv', stringsAsFactors = F)%>% 
  filter(COUNTRY == 'Sierra Leone', 
         YEAR %in% 1997:2001,GEO_PRECISION<=2)

## limit to battles and exclude state perpetrated violence against civilians; drop
## intra-group conflicts; consolidate factional sub-actors into single actors
battles_prec <- ACLED %>%
  filter(EVENT_TYPE %in% c('Battle-No change of territory',
                           'Battle-Non-state actor overtakes territory'),
         !(grepl('Military|Police', ACTOR1, ignore.case = T) &
             EVENT_TYPE == 'Violence against civilians'),
         ACTOR1 != ACTOR2) %>%
  mutate(ACTOR1 = ifelse(grepl('Kamajor Militia', ACTOR1),
                         'Kamajor Militia', ACTOR1),
         ACTOR1 = ifelse(grepl('AFRC: Armed Forces Revolutionary Council', ACTOR1),
                         'AFRC: Armed Forces Revolutionary Council', ACTOR1),
         ACTOR1 = ifelse(grepl('RUF: Revolutionary United Front', ACTOR1),
                         'RUF: Revolutionary United Front', ACTOR1),
         ACTOR2 = ifelse(grepl('Kamajor Militia', ACTOR2),
                         'Kamajor Militia', ACTOR2),
         ACTOR2 = ifelse(grepl('AFRC: Armed Forces Revolutionary Council', ACTOR2),
                         'AFRC: Armed Forces Revolutionary Council', ACTOR2),
         ACTOR2 = ifelse(grepl('RUF: Revolutionary United Front', ACTOR2),
                         'RUF: Revolutionary United Front', ACTOR2))

## limit events to largest rebel groups
battles_prec <- battles_prec %>%
  filter(ACTOR1 %in% c('Kamajor Militia', 'AFRC: Armed Forces Revolutionary Council',
                       'RUF: Revolutionary United Front') |
           ACTOR2 %in% c('Kamajor Militia', 'AFRC: Armed Forces Revolutionary Council',
                         'RUF: Revolutionary United Front'))

## limit events to RUF
battles_prec <- battles_prec %>% filter(ACTOR1 == 'RUF: Revolutionary United Front' |
                                        ACTOR2 == 'RUF: Revolutionary United Front') %>%
  mutate(timestamp = lubridate::ymd(EVENT_DATE), lat = LATITUDE, lon = LONGITUDE) %>%
  dplyr::select(timestamp, lat, lon, EVENT_TYPE) %>%
  filter(lubridate::year(timestamp) %in% 1997:2001)



## attributed RUF attacks only ####

## get violence against civilians
civs_RUF_prec <- civ_comb_prec %>%
  filter(grepl('RUF', actor_tax)) %>% 
  mutate(EVENT_TYPE = 'Violence against civilians',
         lat = latitude, lon = longitude,
         timestamp = date) %>% 
  dplyr::select(timestamp, lat, lon, EVENT_TYPE)

## combine treatment, control, and dependent events
mw_data_RUF_prec <- rbind(battles_prec, civs_RUF_prec)

## create sf of events to measure spatial covariates
mw_data_sf_RUF_prec <- st_as_sf(mw_data_RUF_prec, coords = c('lon', 'lat'),
                           crs = 4326, agr = 'identity')

## measure spatial covariates
mw_data_RUF_prec <- mw_data_RUF_prec %>%
  mutate(pop_dens = log(raster::extract(pop_dens, mw_data_sf_RUF_prec)),
         pop_tot = log(raster::extract(pop_tot, mw_data_sf_RUF_prec)),
         nl = raster::extract(nl, mw_data_sf_RUF_prec),
         cap_dist = log(units::set_units(st_distance(mw_data_sf_RUF_prec, capital,
                                                     by_element = T), km)),
         road_dist = log(units::set_units(apply(st_distance(mw_data_sf_RUF_prec,
                                                            roads), 1, min), km)),
         dia_dist = log(units::set_units(apply(st_distance(mw_data_sf_RUF_prec,
                                                           diamonds), 1, min), km)),
         year = lubridate::year(timestamp))


## carry out matched wake analysis; no SUTVA control
mw_RUF_prec <- matchedwake(mw_data_RUF_prec, t_window = c(5, 60, 5), spat_window = c(2, 10, 2),
                      treatment = c('EVENT_TYPE',
                                    'Battle-Non-state actor overtakes territory'),
                      control = c('EVENT_TYPE',
                                  'Battle-No change of territory'),
                      dependent = c('EVENT_TYPE',
                                    'Violence against civilians'),
                      matchColumns = c('pop_dens', 'nl', 'cap_dist',
                                       'road_dist', 'dia_dist'), alpha2 = .05)

## carry out matched wake analysis; past treatment control control
mw_RUF_tcm_prec <- matchedwake(mw_data_RUF_prec, t_window = c(5, 60, 5), spat_window = c(2, 10, 2),
                          treatment = c('EVENT_TYPE',
                                        'Battle-Non-state actor overtakes territory'),
                          control = c('EVENT_TYPE',
                                      'Battle-No change of territory'),
                          dependent = c('EVENT_TYPE',
                                        'Violence against civilians'),
                          matchColumns = c('pop_dens', 'nl', 'cap_dist',
                                           'road_dist', 'dia_dist'),
                          TCM = T, alpha2 = .05)

## carry out matched wake analysis; delete SUTVA violations control
mw_RUF_stva_prec <- matchedwake(mw_data_RUF_prec, t_window = c(5, 60, 5), spat_window = c(2, 10, 2),
                           treatment = c('EVENT_TYPE',
                                         'Battle-Non-state actor overtakes territory'),
                           control = c('EVENT_TYPE',
                                       'Battle-No change of territory'),
                           dependent = c('EVENT_TYPE',
                                         'Violence against civilians'),
                           matchColumns = c('pop_dens', 'nl', 'cap_dist',
                                            'road_dist', 'dia_dist'),
                           deleteSUTVA = T, alpha2 = .05)

## carry out matched wake analysis; no SUTVA control; weighted
mw_RUF_wg_prec <- matchedwake(mw_data_RUF_prec, t_window = c(5, 60, 5), spat_window = c(2, 10, 2),
                         treatment = c('EVENT_TYPE',
                                       'Battle-Non-state actor overtakes territory'),
                         control = c('EVENT_TYPE',
                                     'Battle-No change of territory'),
                         dependent = c('EVENT_TYPE',
                                       'Violence against civilians'),
                         matchColumns = c('pop_dens', 'nl', 'cap_dist',
                                          'road_dist', 'dia_dist'),
                         weighted = T, alpha2 = .05)

## carry out matched wake analysis; past treatment control control; weighted
mw_RUF_wg_tcm_prec <- matchedwake(mw_data_RUF_prec, t_window = c(5, 60, 5), spat_window = c(2, 10, 2),
                             treatment = c('EVENT_TYPE',
                                           'Battle-Non-state actor overtakes territory'),
                             control = c('EVENT_TYPE',
                                         'Battle-No change of territory'),
                             dependent = c('EVENT_TYPE',
                                           'Violence against civilians'),
                             matchColumns = c('pop_dens', 'nl', 'cap_dist',
                                              'road_dist', 'dia_dist'),
                             TCM = T, weighted = T, alpha2 = .05)

## carry out matched wake analysis; delete SUTVA violations control; weighted
mw_RUF_wg_stva_prec <- matchedwake(mw_data_RUF_prec, t_window = c(5, 60, 5), spat_window = c(2, 10, 2),
                              treatment = c('EVENT_TYPE',
                                            'Battle-Non-state actor overtakes territory'),
                              control = c('EVENT_TYPE',
                                          'Battle-No change of territory'),
                              dependent = c('EVENT_TYPE',
                                            'Violence against civilians'),
                              matchColumns = c('pop_dens', 'nl', 'cap_dist',
                                               'road_dist', 'dia_dist'),
                              deleteSUTVA = T, weighted = T, alpha2 = .05)
```

```{r prec_plot_1_2, fig.ncol=2,out.width = '3in', results='hide', fig.ncol=2, out.width = '3in'}
plot(mw_RUF_prec)
plot(mw_RUF_tcm_prec)
```

```{r prec_plot_3_4, fig.ncol=2,out.width = '3in', results='hide', fig.ncol=2, out.width = '3in'}
plot(mw_RUF_stva_prec)
plot(mw_RUF_wg_prec)
```

```{r prec_plot_5_6, fig.ncol=2,out.width = '3in', results='hide', fig.ncol=2, out.width = '3in'}
plot(mw_RUF_wg_tcm_prec)
plot(mw_RUF_wg_stva_prec)
```

```{r ged_acled_swap}
## return full GED and ACLED to their oject names
GED <- GED_temp
ACLED <- ACLED_temp
rm(GED_temp, ACLED_temp)
```

\clearpage

# Alternate Event Aggregation Rules

```{r analysis_meltt_coding, results='hide'}
# repeat ACLED cleaning after reloading above
names(ACLED)[names(ACLED)=='EVENT_TYPE'] = 'event_tax'
names(ACLED)[names(ACLED)=='ACTOR1'] = 'actor_tax'
names(ACLED)[names(ACLED)=='GEO_PRECISION'] = 'prec_tax'
colnames(ACLED) = tolower(colnames(ACLED))
ACLED$date = as.Date(ACLED$event_date)

## limit ACLED to violence against civilians in Sierra Leone after reloading above
ACLED <- ACLED %>% filter(country == 'Sierra Leone',
                          event_tax == 'Violence against civilians',
                          year >= 1997, year <= 2001)

## combine events
output_lo <- meltt::meltt(ACLED, GED, taxonomies = taxonomies, twindow = 5, spatwindow = 5)
output_hi <- meltt::meltt(ACLED, GED, taxonomies = taxonomies, twindow = 15, spatwindow = 15)

## get number of duplicated events
dup_events_lo <- nrow(output_lo$processed$event_matched)
dup_events_hi <- nrow(output_hi$processed$event_matched)

## calculate percent overlap between datasets
overlap_lo <- nrow(output_lo$processed$event_matched) / nrow(output$processed$deduplicated_index)
overlap_hi <- nrow(output_hi$processed$event_matched) / nrow(output$processed$deduplicated_index)

## extract combined civilian targeting events
civ_comb_lo <- meltt::meltt_data(output)
civ_comb_hi <- meltt::meltt_data(output)



## restrictive meltt aggregation rules; attributed RUF attacks only ####

## get violence against civilians
civs_RUF_lo <- civ_comb_lo %>%
  filter(grepl('RUF', actor_tax)) %>% 
  mutate(EVENT_TYPE = 'Violence against civilians',
         lat = latitude, lon = longitude,
         timestamp = date) %>% 
  dplyr::select(timestamp, lat, lon, EVENT_TYPE)

## combine treatment, control, and dependent events
mw_data_RUF_lo <- rbind(battles, civs_RUF_lo)

## create sf of events to measure spatial covariates
mw_data_sf_RUF_lo <- st_as_sf(mw_data_RUF_lo, coords = c('lon', 'lat'),
                           crs = 4326, agr = 'identity')

## measure spatial covariates
mw_data_RUF_lo <- mw_data_RUF_lo %>%
  mutate(pop_dens = log(raster::extract(pop_dens, mw_data_sf_RUF_lo)),
         pop_tot = log(raster::extract(pop_tot, mw_data_sf_RUF_lo)),
         nl = raster::extract(nl, mw_data_sf_RUF_lo),
         cap_dist = log(units::set_units(st_distance(mw_data_sf_RUF_lo, capital,
                                                     by_element = T), km)),
         road_dist = log(units::set_units(apply(st_distance(mw_data_sf_RUF_lo,
                                                            roads), 1, min), km)),
         dia_dist = log(units::set_units(apply(st_distance(mw_data_sf_RUF_lo,
                                                           diamonds), 1, min), km)),
         year = lubridate::year(timestamp))

## carry out matched wake analysis; no SUTVA control
mw_RUF_lo <- matchedwake(mw_data_RUF_lo, t_window = c(5, 60, 5), spat_window = c(2, 10, 2),
                      treatment = c('EVENT_TYPE',
                                    'Battle-Non-state actor overtakes territory'),
                      control = c('EVENT_TYPE',
                                  'Battle-No change of territory'),
                      dependent = c('EVENT_TYPE',
                                    'Violence against civilians'),
                      matchColumns = c('pop_dens', 'nl', 'cap_dist',
                                       'road_dist', 'dia_dist'), alpha2 = .05)

## carry out matched wake analysis; past treatment control control
mw_RUF_tcm_lo <- matchedwake(mw_data_RUF_lo, t_window = c(5, 60, 5), spat_window = c(2, 10, 2),
                          treatment = c('EVENT_TYPE',
                                        'Battle-Non-state actor overtakes territory'),
                          control = c('EVENT_TYPE',
                                      'Battle-No change of territory'),
                          dependent = c('EVENT_TYPE',
                                        'Violence against civilians'),
                          matchColumns = c('pop_dens', 'nl', 'cap_dist',
                                           'road_dist', 'dia_dist'),
                          TCM = T, alpha2 = .05)

## carry out matched wake analysis; delete SUTVA violations control
mw_RUF_stva_lo <- matchedwake(mw_data_RUF_lo, t_window = c(5, 60, 5), spat_window = c(2, 10, 2),
                           treatment = c('EVENT_TYPE',
                                         'Battle-Non-state actor overtakes territory'),
                           control = c('EVENT_TYPE',
                                       'Battle-No change of territory'),
                           dependent = c('EVENT_TYPE',
                                         'Violence against civilians'),
                           matchColumns = c('pop_dens', 'nl', 'cap_dist',
                                            'road_dist', 'dia_dist'),
                           deleteSUTVA = T, alpha2 = .05)

## carry out matched wake analysis; no SUTVA control; weighted
mw_RUF_wg_lo <- matchedwake(mw_data_RUF_lo, t_window = c(5, 60, 5), spat_window = c(2, 10, 2),
                         treatment = c('EVENT_TYPE',
                                       'Battle-Non-state actor overtakes territory'),
                         control = c('EVENT_TYPE',
                                     'Battle-No change of territory'),
                         dependent = c('EVENT_TYPE',
                                       'Violence against civilians'),
                         matchColumns = c('pop_dens', 'nl', 'cap_dist',
                                          'road_dist', 'dia_dist'),
                         weighted = T, alpha2 = .05)

## carry out matched wake analysis; past treatment control control; weighted
mw_RUF_wg_tcm_lo <- matchedwake(mw_data_RUF_lo, t_window = c(5, 60, 5), spat_window = c(2, 10, 2),
                             treatment = c('EVENT_TYPE',
                                           'Battle-Non-state actor overtakes territory'),
                             control = c('EVENT_TYPE',
                                         'Battle-No change of territory'),
                             dependent = c('EVENT_TYPE',
                                           'Violence against civilians'),
                             matchColumns = c('pop_dens', 'nl', 'cap_dist',
                                              'road_dist', 'dia_dist'),
                             TCM = T, weighted = T, alpha2 = .05)

## carry out matched wake analysis; delete SUTVA violations control; weighted
mw_RUF_wg_stva_lo <- matchedwake(mw_data_RUF_lo, t_window = c(5, 60, 5), spat_window = c(2, 10, 2),
                              treatment = c('EVENT_TYPE',
                                            'Battle-Non-state actor overtakes territory'),
                              control = c('EVENT_TYPE',
                                          'Battle-No change of territory'),
                              dependent = c('EVENT_TYPE',
                                            'Violence against civilians'),
                              matchColumns = c('pop_dens', 'nl', 'cap_dist',
                                               'road_dist', 'dia_dist'),
                              deleteSUTVA = T, weighted = T, alpha2 = .05)



## permissive meltt aggregation rules; attributed RUF attacks only ####

## get violence against civilians
civs_RUF_hi <- civ_comb_hi %>%
  filter(grepl('RUF', actor_tax)) %>% 
  mutate(EVENT_TYPE = 'Violence against civilians',
         lat = latitude, lon = longitude,
         timestamp = date) %>% 
  dplyr::select(timestamp, lat, lon, EVENT_TYPE)

## combine treatment, control, and dependent events
mw_data_RUF_hi <- rbind(battles, civs_RUF_hi)

## create sf of events to measure spatial covariates
mw_data_sf_RUF_hi <- st_as_sf(mw_data_RUF_hi, coords = c('lon', 'lat'),
                           crs = 4326, agr = 'identity')

## measure spatial covariates
mw_data_RUF_hi <- mw_data_RUF_hi %>%
  mutate(pop_dens = log(raster::extract(pop_dens, mw_data_sf_RUF_hi)),
         pop_tot = log(raster::extract(pop_tot, mw_data_sf_RUF_hi)),
         nl = raster::extract(nl, mw_data_sf_RUF_hi),
         cap_dist = log(units::set_units(st_distance(mw_data_sf_RUF_hi, capital,
                                                     by_element = T), km)),
         road_dist = log(units::set_units(apply(st_distance(mw_data_sf_RUF_hi,
                                                            roads), 1, min), km)),
         dia_dist = log(units::set_units(apply(st_distance(mw_data_sf_RUF_hi,
                                                           diamonds), 1, min), km)),
         year = lubridate::year(timestamp))

## carry out matched wake analysis; no SUTVA control
mw_RUF_hi <- matchedwake(mw_data_RUF_hi, t_window = c(5, 60, 5), spat_window = c(2, 10, 2),
                      treatment = c('EVENT_TYPE',
                                    'Battle-Non-state actor overtakes territory'),
                      control = c('EVENT_TYPE',
                                  'Battle-No change of territory'),
                      dependent = c('EVENT_TYPE',
                                    'Violence against civilians'),
                      matchColumns = c('pop_dens', 'nl', 'cap_dist',
                                       'road_dist', 'dia_dist'), alpha2 = .05)

## carry out matched wake analysis; past treatment control control
mw_RUF_tcm_hi <- matchedwake(mw_data_RUF_hi, t_window = c(5, 60, 5), spat_window = c(2, 10, 2),
                          treatment = c('EVENT_TYPE',
                                        'Battle-Non-state actor overtakes territory'),
                          control = c('EVENT_TYPE',
                                      'Battle-No change of territory'),
                          dependent = c('EVENT_TYPE',
                                        'Violence against civilians'),
                          matchColumns = c('pop_dens', 'nl', 'cap_dist',
                                           'road_dist', 'dia_dist'),
                          TCM = T, alpha2 = .05)

## carry out matched wake analysis; delete SUTVA violations control
mw_RUF_stva_hi <- matchedwake(mw_data_RUF_hi, t_window = c(5, 60, 5), spat_window = c(2, 10, 2),
                           treatment = c('EVENT_TYPE',
                                         'Battle-Non-state actor overtakes territory'),
                           control = c('EVENT_TYPE',
                                       'Battle-No change of territory'),
                           dependent = c('EVENT_TYPE',
                                         'Violence against civilians'),
                           matchColumns = c('pop_dens', 'nl', 'cap_dist',
                                            'road_dist', 'dia_dist'),
                           deleteSUTVA = T, alpha2 = .05)

## carry out matched wake analysis; no SUTVA control; weighted
mw_RUF_wg_hi <- matchedwake(mw_data_RUF_hi, t_window = c(5, 60, 5), spat_window = c(2, 10, 2),
                         treatment = c('EVENT_TYPE',
                                       'Battle-Non-state actor overtakes territory'),
                         control = c('EVENT_TYPE',
                                     'Battle-No change of territory'),
                         dependent = c('EVENT_TYPE',
                                       'Violence against civilians'),
                         matchColumns = c('pop_dens', 'nl', 'cap_dist',
                                          'road_dist', 'dia_dist'),
                         weighted = T, alpha2 = .05)

## carry out matched wake analysis; past treatment control control; weighted
mw_RUF_wg_tcm_hi <- matchedwake(mw_data_RUF_hi, t_window = c(5, 60, 5), spat_window = c(2, 10, 2),
                             treatment = c('EVENT_TYPE',
                                           'Battle-Non-state actor overtakes territory'),
                             control = c('EVENT_TYPE',
                                         'Battle-No change of territory'),
                             dependent = c('EVENT_TYPE',
                                           'Violence against civilians'),
                             matchColumns = c('pop_dens', 'nl', 'cap_dist',
                                              'road_dist', 'dia_dist'),
                             TCM = T, weighted = T, alpha2 = .05)

## carry out matched wake analysis; delete SUTVA violations control; weighted
mw_RUF_wg_stva_hi <- matchedwake(mw_data_RUF_hi, t_window = c(5, 60, 5), spat_window = c(2, 10, 2),
                              treatment = c('EVENT_TYPE',
                                            'Battle-Non-state actor overtakes territory'),
                              control = c('EVENT_TYPE',
                                          'Battle-No change of territory'),
                              dependent = c('EVENT_TYPE',
                                            'Violence against civilians'),
                              matchColumns = c('pop_dens', 'nl', 'cap_dist',
                                               'road_dist', 'dia_dist'),
                              deleteSUTVA = T, weighted = T, alpha2 = .05)
```

In this section we present results using alternate rules in the `meltt` package to aggregate civilian targeting events from GED and ACLED. In our main analysis presented in the paper, we treat any events that are similar in type as the same event if they occurred within 10 days and 10k of each other. To test the sensitivity of our results to this coding choice, we present an analysis with (1) **a more restrictive aggreation rule (5 days and 5km)** and (2) **a more permissive one (15 days and 15km)**. The restrictive rule identifies `r dup_events_lo` duplicated events, the permissive one identifies `r dup_events_hi`, compared to `r dup_events` in our main analysis. This corresponds to a `r overlap_lo`%, `r overlap_hi`%, and `r overlap`% overlap in events for each aggregation rule. 

**Restrictive analysis (5 days and 5km)**

```{r meltt_coding_plot_lo_1_2, out.width = '3in', results='hide'}
plot(mw_RUF_wg_tcm_lo)
```

**Permissive analysis (15 days and 15km)** 

```{r meltt_coding_plot_hi_1_2, out.width = '3in', results='hide'}
plot(mw_RUF_wg_tcm_hi)
```
\clearpage

# All Civilian Targeting

This section presents results from models that test the effect of RUF territorial takeover on subsequent civilian targeting by all of the three main rebel groups (RUF, AFRC, and Kamajors). This means that the dependent variable is only civilian targeting events that can be attributed to any of these three actors. We first present the frequency of events in the data before turning to the different models fitted. 

```{r analysis_all_rebels, results = 'hide'}
## all rebel civilian killings ####

## get violence against civilians
civs <- civ_comb %>%
  mutate(EVENT_TYPE = 'Violence against civilians',
         lat = latitude, lon = longitude,
         timestamp = date) %>% 
  dplyr::select(timestamp, lat, lon, EVENT_TYPE)

## combine treatment, control, and dependent events
mw_data_all <- rbind(battles, civs)

## create sf of events to measure spatial covariates
mw_data_all_sf <- st_as_sf(mw_data_all, coords = c('lon', 'lat'),
                       crs = 4326, agr = 'identity')

## measure spatial covariates
mw_data_all <- mw_data_all %>%
  mutate(pop_dens = log(raster::extract(pop_dens, mw_data_all_sf)),
         pop_tot = log(raster::extract(pop_tot, mw_data_all_sf)),
         nl = raster::extract(nl, mw_data_all_sf),
         cap_dist = log(units::set_units(st_distance(mw_data_all_sf, capital, by_element = T), km)),
         road_dist = log(units::set_units(apply(st_distance(mw_data_all_sf, roads), 1, min), km)),
         dia_dist = log(units::set_units(apply(st_distance(mw_data_all_sf, diamonds), 1, min), km)),
         year = lubridate::year(timestamp))

## carry out matched wake analysis; no SUTVA control
mw_all <- matchedwake(mw_data_all, t_window = c(5, 60, 5), spat_window = c(2, 10, 2),
                      treatment = c('EVENT_TYPE',
                                    'Battle-Non-state actor overtakes territory'),
                      control = c('EVENT_TYPE',
                                  'Battle-No change of territory'),
                      dependent = c('EVENT_TYPE',
                                    'Violence against civilians'),
                      matchColumns = c('pop_dens', 'nl', 'cap_dist',
                                       'road_dist', 'dia_dist'), alpha2 = .05)

## carry out matched wake analysis; past treatment control control
mw_all_tcm <- matchedwake(mw_data_all, t_window = c(5, 60, 5), spat_window = c(2, 10, 2),
                          treatment = c('EVENT_TYPE',
                                        'Battle-Non-state actor overtakes territory'),
                          control = c('EVENT_TYPE',
                                      'Battle-No change of territory'),
                          dependent = c('EVENT_TYPE',
                                        'Violence against civilians'),
                          matchColumns = c('pop_dens', 'nl', 'cap_dist',
                                           'road_dist', 'dia_dist'),
                          TCM = T, alpha2 = .05)

## carry out matched wake analysis; delete SUTVA violations control
mw_all_stva <- matchedwake(mw_data_all, t_window = c(5, 60, 5), spat_window = c(2, 10, 2),
                           treatment = c('EVENT_TYPE',
                                         'Battle-Non-state actor overtakes territory'),
                           control = c('EVENT_TYPE',
                                       'Battle-No change of territory'),
                           dependent = c('EVENT_TYPE',
                                         'Violence against civilians'),
                           matchColumns = c('pop_dens', 'nl', 'cap_dist',
                                            'road_dist', 'dia_dist'),
                           deleteSUTVA = T, alpha2 = .05)

## carry out matched wake analysis; no SUTVA control; weighted
mw_all_wg <- matchedwake(mw_data_all, t_window = c(5, 60, 5), spat_window = c(2, 10, 2),
                         treatment = c('EVENT_TYPE',
                                       'Battle-Non-state actor overtakes territory'),
                         control = c('EVENT_TYPE',
                                     'Battle-No change of territory'),
                         dependent = c('EVENT_TYPE',
                                       'Violence against civilians'),
                         matchColumns = c('pop_dens', 'nl', 'cap_dist',
                                          'road_dist', 'dia_dist'),
                         weighted = T, alpha2 = .05)

## carry out matched wake analysis; past treatment control control; weighted
mw_all_wg_tcm <- matchedwake(mw_data_all, t_window = c(5, 60, 5), spat_window = c(2, 10, 2),
                             treatment = c('EVENT_TYPE',
                                           'Battle-Non-state actor overtakes territory'),
                             control = c('EVENT_TYPE',
                                         'Battle-No change of territory'),
                             dependent = c('EVENT_TYPE',
                                           'Violence against civilians'),
                             matchColumns = c('pop_dens', 'nl', 'cap_dist',
                                              'road_dist', 'dia_dist'),
                             TCM = T, weighted = T, alpha2 = .05)

## carry out matched wake analysis; delete SUTVA violations control; weighted
mw_all_wg_stva <- matchedwake(mw_data_all, t_window = c(5, 60, 5), spat_window = c(2, 10, 2),
                              treatment = c('EVENT_TYPE',
                                            'Battle-Non-state actor overtakes territory'),
                              control = c('EVENT_TYPE',
                                          'Battle-No change of territory'),
                              dependent = c('EVENT_TYPE',
                                            'Violence against civilians'),
                              matchColumns = c('pop_dens', 'nl', 'cap_dist',
                                               'road_dist', 'dia_dist'),
                              deleteSUTVA = T, weighted = T, alpha2 = .05)
```

```{r all_rebels_desc_event_hist, fig.cap = 'Frequency of treatment, control, and dependent events; all main rebel group events.', fig.height = 3, fig.width=8, out.width = '6in'}
ggplot(mw_data_all, aes(x = timestamp)) +
  geom_histogram() +
  facet_wrap(~ EVENT_TYPE) +
  labs(x = '', y = 'Count') +
  theme_rw() +
  theme(strip.text = element_text(size = 7.5))
```

The matched wake analysis was specified with (1) no weighting for inbalance or controlling for previous events, (2) controlling for previous treatment and control events, (3) omitting overlapping wakes, (4) weighting to account for unbalanced treatments, **(5) weighting for addressing inbalance and controlling for previous events**, (6) weighting and omitting of overlapping wakes. The point estimates are substantively similar to the models using exclusively RUF civilian targeting, but far fewer space-time window combinations produce statistically significant results. This suggests that including civilian targeting by the other two groups merely adds random noise to the model. Estimates remain unbiased but efficiency goes down; resulting in larger standard errors, and fewer significant combiations. Accordingly, we argue that civilian targeting by a group can be explained by that group's specific strategic actions.

```{r all_rebels_plot_1_2, fig.ncol=2,out.width = '3in', results='hide', fig.ncol=2}
plot(mw_all)
plot(mw_all_tcm)
```

```{r all_rebels_plot_3_4, fig.ncol=2,out.width = '3in', results='hide', fig.ncol=2}
plot(mw_all_stva)
plot(mw_all_wg)
```

```{r all_rebels_plot_5_6, fig.ncol=2,out.width = '3in', results='hide', fig.ncol=2}
plot(mw_all_wg_tcm)
plot(mw_all_wg_stva)
```

\clearpage

# ACLED Events Only

This section presents results from models that test the effect of RUF territorial takeover on subsequent civilian targeting using only events included in ACLED. This means that the dependent variable is civilian targeting events that can be attributed to the RUF, but there are fewer civilian targeting events included in the data because events from GED are not merged in. The number of treatment and control events remains unchanged because they both come from ACLED. 

```{r analysis_acled, results = 'hide'}
## ACLED events only ####

## reload ACLED for capitalized variable names
ACLED <- read.csv('Data/events/Africa_1997-2018_upd-Jul23.csv', stringsAsFactors = F)%>% 
  filter(COUNTRY == 'Sierra Leone', 
         YEAR %in% 1997:2001)

## subset ACLED to events from three main rebel groups
ACLED <- ACLED %>%
  filter(EVENT_TYPE %in% c('Battle-No change of territory',
                           'Battle-Non-state actor overtakes territory',
                           'Violence against civilians'),
         !(grepl('Military|Police', ACTOR1, ignore.case = T)),
         ACTOR1 != ACTOR2) %>%
    mutate(ACTOR1 = ifelse(grepl('Kamajor Militia', ACTOR1),
                           'Kamajor Militia', ACTOR1),
           ACTOR1 = ifelse(grepl('AFRC: Armed Forces Revolutionary Council', ACTOR1),
                           'AFRC: Armed Forces Revolutionary Council', ACTOR1),
           ACTOR1 = ifelse(grepl('RUF: Revolutionary United Front', ACTOR1),
                           'RUF: Revolutionary United Front', ACTOR1),
           ACTOR2 = ifelse(grepl('Kamajor Militia', ACTOR2),
                           'Kamajor Militia', ACTOR2),
           ACTOR2 = ifelse(grepl('AFRC: Armed Forces Revolutionary Council', ACTOR2),
                           'AFRC: Armed Forces Revolutionary Council', ACTOR2),
           ACTOR2 = ifelse(grepl('RUF: Revolutionary United Front', ACTOR2),
                           'RUF: Revolutionary United Front', ACTOR2),
           EVENT_DATE = as.Date(EVENT_DATE))

## get RUF violence against civilians
mw_data_ACLED <- ACLED %>% filter(ACTOR1 == 'RUF: Revolutionary United Front' |
                                    ACTOR2 == 'RUF: Revolutionary United Front') %>% 
  mutate(lat = LATITUDE, lon = LONGITUDE) %>% 
  dplyr::select(timestamp = EVENT_DATE, lat, lon, EVENT_TYPE)

## create sf of events to measure spatial covariates
mw_data_ACLED_sf <- st_as_sf(mw_data_ACLED, coords = c('lon', 'lat'),
                             crs = 4326, agr = 'identity')

## measure spatial covariates
mw_data_ACLED <- mw_data_ACLED %>%
  mutate(pop_dens = log(raster::extract(pop_dens, mw_data_ACLED_sf)),
         pop_tot = log(raster::extract(pop_tot, mw_data_ACLED_sf)),
         nl = raster::extract(nl, mw_data_ACLED_sf),
         cap_dist = log(units::set_units(st_distance(mw_data_ACLED_sf,
                                                     capital, by_element = T), km)),
         road_dist = log(units::set_units(apply(st_distance(mw_data_ACLED_sf,
                                                            roads), 1, min), km)),
         dia_dist = log(units::set_units(apply(st_distance(mw_data_ACLED_sf,
                                                           diamonds), 1, min), km)),
         year = lubridate::year(timestamp))

## carry out matched wake analysis; no SUTVA control
mw_ACLED <- matchedwake(mw_data_ACLED, t_window = c(5, 60, 5), spat_window = c(2, 10, 2),
                        treatment = c('EVENT_TYPE',
                                      'Battle-Non-state actor overtakes territory'),
                        control = c('EVENT_TYPE',
                                    'Battle-No change of territory'),
                        dependent = c('EVENT_TYPE',
                                      'Violence against civilians'),
                        matchColumns = c('pop_dens', 'nl', 'cap_dist',
                                         'road_dist', 'dia_dist'), alpha2 = .05)

## carry out matched wake analysis; past treatment control control
mw_ACLED_tcm <- matchedwake(mw_data_ACLED, t_window = c(5, 60, 5), spat_window = c(2, 10, 2),
                            treatment = c('EVENT_TYPE',
                                          'Battle-Non-state actor overtakes territory'),
                            control = c('EVENT_TYPE',
                                        'Battle-No change of territory'),
                            dependent = c('EVENT_TYPE',
                                          'Violence against civilians'),
                            matchColumns = c('pop_dens', 'nl', 'cap_dist',
                                             'road_dist', 'dia_dist'),
                            TCM = T, alpha2 = .05)

## carry out matched wake analysis; delete SUTVA violations control
mw_ACLED_stva <- matchedwake(mw_data_ACLED, t_window = c(5, 60, 5), spat_window = c(2, 10, 2),
                             treatment = c('EVENT_TYPE',
                                           'Battle-Non-state actor overtakes territory'),
                             control = c('EVENT_TYPE',
                                         'Battle-No change of territory'),
                             dependent = c('EVENT_TYPE',
                                           'Violence against civilians'),
                             matchColumns = c('pop_dens', 'nl', 'cap_dist',
                                              'road_dist', 'dia_dist'),
                             deleteSUTVA = T, alpha2 = .05)

## carry out matched wake analysis; no SUTVA control; weighted
mw_ACLED_wg <- matchedwake(mw_data_ACLED, t_window = c(5, 60, 5), spat_window = c(2, 10, 2),
                           treatment = c('EVENT_TYPE',
                                         'Battle-Non-state actor overtakes territory'),
                           control = c('EVENT_TYPE',
                                       'Battle-No change of territory'),
                           dependent = c('EVENT_TYPE',
                                         'Violence against civilians'),
                           matchColumns = c('pop_dens', 'nl', 'cap_dist',
                                            'road_dist', 'dia_dist'),
                           weighted = T, alpha2 = .05)

## carry out matched wake analysis; past treatment control control; weighted
mw_ACLED_wg_tcm <- matchedwake(mw_data_ACLED, t_window = c(5, 60, 5), spat_window = c(2, 10, 2),
                               treatment = c('EVENT_TYPE',
                                             'Battle-Non-state actor overtakes territory'),
                               control = c('EVENT_TYPE',
                                           'Battle-No change of territory'),
                               dependent = c('EVENT_TYPE',
                                             'Violence against civilians'),
                               matchColumns = c('pop_dens', 'nl', 'cap_dist',
                                                'road_dist', 'dia_dist'),
                               TCM = T, weighted = T, alpha2 = .05)

## carry out matched wake analysis; delete SUTVA violations control; weighted
mw_ACLED_wg_stva <- matchedwake(mw_data_ACLED, t_window = c(5, 60, 5), spat_window = c(2, 10, 2),
                                treatment = c('EVENT_TYPE',
                                              'Battle-Non-state actor overtakes territory'),
                                control = c('EVENT_TYPE',
                                            'Battle-No change of territory'),
                                dependent = c('EVENT_TYPE',
                                              'Violence against civilians'),
                                matchColumns = c('pop_dens', 'nl', 'cap_dist',
                                                 'road_dist', 'dia_dist'),
                                deleteSUTVA = T, weighted = T, alpha2 = .05)
```

```{r acled_dest_event_hist, fig.cap = 'Frequency of treatment, control, and dependent events; only ACLED events.', fig.ncol=2,   fig.height = 3, fig.width=8, out.width = '6in'}
ggplot(mw_data_ACLED, aes(x = timestamp)) +
  geom_histogram() +
  facet_wrap(~ EVENT_TYPE) +
  labs(x = '', y = 'Count') +
  theme_rw() +
  theme(strip.text = element_text(size = 7.5))
```

From upper left to bottom right, the MWA for ACLED events only was specified with (1) no weighting or controlling for previous events, (2) controlling for previous treatment and control events, (3) ommitting overlapping wakes, (4) weighted to account for unbalanced treatment, **(5) weighted to account for unbalance and controlled for previous events**, (6) weighted and ommiting of overlapping wakes. We do not find significant results if only ACLED data is used. 

```{r acled_plot_1_2, fig.ncol=2,out.width = '3in', results='hide'}
plot(mw_ACLED)
plot(mw_ACLED_tcm)
```

```{r acled_plot_3_4, fig.ncol=2,out.width = '3in', results='hide'}
plot(mw_ACLED_stva)
plot(mw_ACLED_wg)
```

```{r acled_plot_5_6, fig.ncol=2,out.width = '3in', results='hide'}
plot(mw_ACLED_wg_tcm)
plot(mw_ACLED_wg_stva)
```

\clearpage

# Alternate Space Time Windows

This section presents results from models that use finer and coarser spatial and temporal resolutions in the construction of the space time windows. The main model specification as presented in the research note was used (weighted to account for unbalanced treatment and controlling for previous treatment and control events). From upper left to bottom right, the windows were chosen the following: **(1) two day window**, **(2) ten day window**, **(3) 1km spatial window**, (4) **3km spatial window**.

```{r analysis_spacetime, results = 'hide'}
## space-time window robustness ####

## carry out matched wake analysis; past treatment control control; weighted; short time
mw_RUF_wg_tcm_ts <- matchedwake(mw_data_RUF, t_window = c(2, 60, 2), spat_window = c(2, 10, 2),
                                treatment = c('EVENT_TYPE',
                                              'Battle-Non-state actor overtakes territory'),
                                control = c('EVENT_TYPE',
                                            'Battle-No change of territory'),
                                dependent = c('EVENT_TYPE',
                                              'Violence against civilians'),
                                matchColumns = c('pop_dens', 'nl', 'cap_dist',
                                                 'road_dist', 'dia_dist'),
                                TCM = T, weighted = T, alpha2 = .05)

## carry out matched wake analysis; past treatment control control; weighted; long time
mw_RUF_wg_tcm_tl <- matchedwake(mw_data_RUF, t_window = c(10, 60, 10), spat_window = c(2, 10, 2),
                                treatment = c('EVENT_TYPE',
                                              'Battle-Non-state actor overtakes territory'),
                                control = c('EVENT_TYPE',
                                            'Battle-No change of territory'),
                                dependent = c('EVENT_TYPE',
                                              'Violence against civilians'),
                                matchColumns = c('pop_dens', 'nl', 'cap_dist',
                                                 'road_dist', 'dia_dist'),
                                TCM = T, weighted = T, alpha2 = .05)

## carry out matched wake analysis; past treatment control control; weighted; short distance
mw_RUF_wg_tcm_ss <- matchedwake(mw_data_RUF, t_window = c(5, 60, 5), spat_window = c(1, 10, 1),
                                treatment = c('EVENT_TYPE',
                                              'Battle-Non-state actor overtakes territory'),
                                control = c('EVENT_TYPE',
                                            'Battle-No change of territory'),
                                dependent = c('EVENT_TYPE',
                                              'Violence against civilians'),
                                matchColumns = c('pop_dens', 'nl', 'cap_dist',
                                                 'road_dist', 'dia_dist'),
                                TCM = T, weighted = T, alpha2 = .05)

## carry out matched wake analysis; past treatment control control; weighted; long distance
mw_RUF_wg_tcm_sl <- matchedwake(mw_data_RUF, t_window = c(5, 60, 5), spat_window = c(3, 12, 3),
                                treatment = c('EVENT_TYPE',
                                              'Battle-Non-state actor overtakes territory'),
                                control = c('EVENT_TYPE',
                                            'Battle-No change of territory'),
                                dependent = c('EVENT_TYPE',
                                              'Violence against civilians'),
                                matchColumns = c('pop_dens', 'nl', 'cap_dist',
                                                 'road_dist', 'dia_dist'),
                                TCM = T, weighted = T, alpha2 = .05)
```

```{r spacetime_plot_1_2, fig.ncol=2,out.width = '3in', results='hide'}
plot(mw_RUF_wg_tcm_ts)
plot(mw_RUF_wg_tcm_tl)
```


```{r spacetime_plot_3_4, fig.ncol=2,out.width = '3in', results='hide'}
plot(mw_RUF_wg_tcm_ss)
plot(mw_RUF_wg_tcm_sl)
```

\clearpage

# Qualitative assessment of civilian victimzation

To complement our quantitative analysis, we provide a random extract of our data on civilian targeting as recorded by ACLED and GED to illustrate how the RUF interacted with civilians in their territory. The table below displays 25 dependent events of civilian victimization and provides a short description of what happened during this event based on news sources. In general, ACLED uses "(1) information from local, regional, national and continental media is reviewed daily;  (2) NGO reports are used to supplement media reporting in hard to access cases; (3) regionally focused news reports and analyses are integrated to supplement daily media reporting" (see ACLED codebook 2017, 30). GED, on the other hand, uses "1. global newswire reporting 2. global monitoring and translation of local news performed by the BBC 3. secondary sources such as local  media, NGO and IGO reports, field reports, books etc" (see Croicu/Sundberg 2017, 12). Specific sources are "Reuters News, Agence France Presse (in English), Associated Press, Xinhua (in English) as well as BBC Monitoring" (see Croicu/Sundberg 2017, 12). Overall, a broad variety of sources is used to code event data but these sources might be biased on various dimensions (e.g. urban-rural dimension) and we cannot account for this. The accounts below stem from No Peace Without Justice and only refer to RUF-conducted attacks against civilians.

```{r qual_sample, results = 'asis'}
qual_sample <-  read.csv("Data/qual_sample.csv")[,-c(1,3,4)]
names(qual_sample)<- c("Date","Description", "Motive for civilian killings")
print(xtable(qual_sample,
             caption = 'Qualitative assessment of events of civilian victimization'),
      include.rownames = F, comment = F,size="small")
```


# Matching Statistics
See full matching statistics on next page. 

\blandscape 
```{r matching_statistics, results = 'asis'}
full_results <- cbind(mw_RUF_wg_tcm$estimates,mw_RUF_wg_tcm$matching)[,-c(6,7)]
names(full_results)<- c("Time",
                                  "Space",
                                  "Estimate",
                                  "P-value",
                                  "Adj R2",
                                  "Control events (pre)",
                                  "Treatment events (pre)",
                                  "L1 (pre)",
                                  "CS (pre)",
                                  "Control events (post)",
                                  "Treatment events (post)",
                                  "L1 (post)",
                                  "CS (post)"
                                  )
print(xtable(full_results,
             caption = 'Full matching statistics and representation of results'),
      include.rownames = F, comment = F,size="tiny")
```
\elandscape   

# Computing Environment

```{r cleanup, results = 'asis'}
toLatex(sessionInfo())
```
